@echo off
IF /I [%1]==[] (
SET /p configuration=StreakyDownloader: debug, release, test, coverage or clean?
) ELSE SET configuration=%1

goto %configuration%

:CLEAN
ATTRIB -H src\StreakyDownloader.suo
del src\StreakyDownloader.suo
del src\StreakyDownloader.csproj.user
rmdir /s /q src\StreakyDownloader\obj


rmdir /s /q test\StreakyDownloader_UnitTests\bin
rmdir /s /q test\StreakyDownloader_UnitTests\obj

IF [%configuration%]==[clean] (
   goto DONESKI
)


:: delete the temporary files
del /F doc\script\engineVersion.js
del /F doc\script\appVersion.js

IF [%configuration%]==[doc] (
   goto DONESKI
)

:DEBUG
:RELEASE


:: above are the other .net framework versions that we may be interested in the future.
:: build the application using v3.5 of MSBuild.  see the SVN History of this file if we need to switch
:: to another version of MSBuild
IF EXIST "%WinDir%\Microsoft.NET\Framework\v3.5\MSBuild.exe" SET "FrameworkDir=%WinDir%\Microsoft.NET\Framework\v3.5\"
%FrameworkDir%\msbuild src\StreakyDownloader.sln  /p:Configuration=%configuration%

:TEST
:: TODO check if nunit is in the path

:: run the nUnit tests for the StreakyDownload application (assumes nunit is in the path)
nunit-console.exe /xml:bin\UnitTest_Results\StreakyDownloader_UnitTest_Results.xml bin\StreakyDownloader_UnitTests.dll

:: no need to run BOTH the unit tests on their own AND generate the coverage information.
goto DONESKI

:COVERAGE
:: TODO: check if ncover is in the path

:: assumes the ncover.console.exe and nunit-console.exe are in the path.
NCover.Console.exe //x bin\UnitTest_Results\StreakyDownloader_Coverage_Report.xml //log-file bin\UnitTest_Results\StreakyDownloader_Coverage.log //reg //w "bin" //v "nunit-console.exe" StreakyDownloader_UnitTests.dll

:DONESKI
